<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父组件向子组传值案例</title>
    <script src="vue.js"></script>
    <style>
        .container{
            width: 1800px;
            margin: 50 auto;
        }
        .item{
            float: left;
            margin: 20px;
            text-align: center;
            font-size: 25px;
            border-radius: 15px;
            background-color: #cccc;
        }
        .item img{
            width: 320px;
            height: 180px;
        }
    </style>
</head>
<body>
    <template id="lessionItemTemplate">
        <div class="item">
            <img :src="imgpath">
            <div>
                <span>{{cname}}</span>
                <div>{{author}}</div>
            </div>
        </div>
    </template>
    <template id="lessionListTemplate">
        <div class="container">
            <lessionitem imgpath="images/model264 (1).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (2).jpg" cname="WEB前端开发" author="李老师"></lessionitem>
            <lessionitem imgpath="images/model264 (3).jpg" cname="WEB前端框架" author="翟老师"></lessionitem>
            <lessionitem imgpath="images/model264 (4).jpg" cname="SSM轻量级框架" author="王老师"></lessionitem>
            <lessionitem imgpath="images/model264 (5).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (6).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (7).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (8).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (9).jpg" cname="JavaWEB开发" author="张老师"></lessionitem>
            <lessionitem imgpath="images/model264 (10).jpg" cname="数据库开发" author="刘老师"></lessionitem> 
       </div>
    </template>
    <div id="app">
        <lessionlist></lessionlist>
    </div>
</body>
</html>
<script>
    var vm=new Vue({
        el:'#app',
        components:{
            'lessionlist':{
                template:'#lessionListTemplate',
                components:{
                    'lessionitem':{
                        template:'#lessionItemTemplate',
                        props:['imgpath','cname','author']
                    }
                }
            }
        }
    });
</script>